#ifndef _LED_DISPLAY_H
#define _LED_DISPLAY_H
#include "gd32e23x.h"
#define BLUE_LED_IDLE              0
#define VOL_CHANGE_MODE            1
#define GATEWAY_PAIR_MODE             2
#define GATEWAY_UNPAIR_MODE       3
#define MUSIC_CHANGE_MODE          4
#define DOORBELL_PLAY_MODE          5

#define RED_LED_IDLE              0
#define ADD_SUBDEV_MODE           1
#define SMARTCONFIG_MODE          2
#define AP_MODE                   4
#define GATEWAY_ONLINE_MODE       6
#define GATEWAY_CONFIGED_BUT_NOT_CONNECT_CLOUD       7

#define PROMPT_SMARTCONFIG_MODE          8
#define PROMPT_AP_MODE                   9
#define GATEWAY_RESET_FACTORY_MODE       10
#define PRE_GATEWAY_RESET_FACTORY_MODE       11


#define RED_LED_PORT         GPIOB
#define RED_LED_PIN          GPIO_PIN_3

#define BLUE_LED_PORT         GPIOA
#define BLUE_LED_PIN          GPIO_PIN_15

#define LED_SMARTCONFIG_THR   250     
#define LED_AP_THR            1500

#define LED_SMARTCONFIG_BIT        0
#define LED_AP_BIT                 1
#define LED_NOT_CONNECT_WIFI_BIT   2
#define LED_CONNECTED_WIFI_BIT     3
#define LED_CONNECTED_CLOUD_BIT    4



#define RED_LED_ON           GPIO_BC(RED_LED_PORT) = RED_LED_PIN
#define RED_LED_OFF          GPIO_BOP(RED_LED_PORT) = RED_LED_PIN

#define BLUE_LED_ON          GPIO_BC(BLUE_LED_PORT) = BLUE_LED_PIN
#define BLUE_LED_OFF         GPIO_BOP(BLUE_LED_PORT) = BLUE_LED_PIN

extern volatile uint8_t led_int_avoid;

void factory_all_led(void);

void led_dispaly_init(void);
void led_timer_int_handler(void);
uint8_t close_red_display_addsub_mode(void);
uint8_t close_gateway_pair_mode(void);

void led_display_mainloop(void);
void set_blue_display_mode(uint8_t mode);
void set_red_display_mode(uint8_t mode);

#endif

